<?php
//+-------------------------------------------------------------
//| 
//+-------------------------------------------------------------
//| Author Liu LianSen <liansen@d3zz.com> 
//+-------------------------------------------------------------
//| Date 2017-10-12
//+-------------------------------------------------------------
namespace app\common\command;

use app\sys\model\SysCrontab;
use think\console\Input;
use think\console\Output;

class Command extends \think\console\Command
{
    public function run(Input $input, Output $output)
    {
        $start  = microtime(1);
        $now    = date('Y-m-d H:i:s');
        $return = parent::run($input, $output); // TODO: Change the autogenerated stub
        $used   = microtime(1)-$start;
        $model  = SysCrontab::get(['class_name' => get_class($this)]);
        if($model){
            $model->last_exec_time = $now;
            $model->last_used_time = $used;
            $model->isUpdate()->save();
        }
        return $return;
    }
}